#ifndef BACKGROUNDIMAGE_H
#define BACKGROUNDIMAGE_H

#include "AnimatedSprite.h"
#include "Vector2di.h"
#include "Vector2df.h"
//#include <>

// This is a thin wrapper on the animated sprite that stores the offset and movement rate
class BackgroundImage
{
    public:
        BackgroundImage();
        BackgroundImage(AnimatedSprite *sprite, Vector2di offset, Vector2di moveA, Vector2di forEveryB, pair<bool,bool> repeat);
        virtual ~BackgroundImage();

        void setSprite(AnimatedSprite *sprite) { m_sprite = sprite; }
        void setOffset(const Vector2di& offset) { m_offset = offset; }
        void setMovementRate(const Vector2di& moveA, const Vector2di& forEveryB) { m_moveA = moveA; m_forEveryB = forEveryB; }
        void setRepeatX(CRbool val) {m_repeat.first = val;};
        void setRepeatY(CRbool val) {m_repeat.second = val;};
        void updateScreenPosition(const Vector2df& mapOffset);
        void render();

    protected:
        AnimatedSprite *m_sprite;
        Vector2di m_screenPosition;
        Vector2di m_offset;
        // These define the movement rate as A pixels of background per B pixels of foreground
        // This seems to me to offer the maximum precision in specifying the movement rate
        Vector2di m_moveA;
        Vector2di m_forEveryB;
        pair<bool, bool> m_repeat; // <x,y>
    private:
};

#endif // BACKGROUNDIMAGE_H
